
<%@page import="com.yymmarket.forum.cache.ForumCache"%>
<%@page import="com.yymmarket.forum.user.UserBean"%><%@page import="com.yymmarket.forum.util.SessionUtil,java.util.Date,com.yymmarket.forum.chat.*,com.yymmarket.framework.WebAction"%><%@ 
page contentType="text/vnd.wap.wml;charset=utf-8"%><%
response.setHeader("Cache-Control","no-cache");
WebAction webAction = new WebAction(request,response);
String content = webAction.getParameterString("content");
int toId = webAction.getParameterInt("toId");
Integer uid = SessionUtil.getSessionUserId(request);
int chatId = webAction.getParameterInt("chatId");
int hide = webAction.getParameterInt("hide");
UserBean userBean = ForumCache.getUser(uid);

ChatBean chat = new ChatBean();
chat.setContent(content);
chat.setFromId(userBean.getId());
chat.setFromUser(userBean.getUserName());
if(toId>0){
	UserBean toUserBean = ForumCache.getUser(toId);
	chat.setToId(toId);
	chat.setToUser(toUserBean.getUserName());
}
chat.setCreateTime(new Date());
chat.setChatId(chatId);
chat.setHide(hide);
ChatService chatService = ChatService.getInstance();
chatService.addChat(chat);
response.sendRedirect(response.encodeURL("chat.jsp"));
%>